/*
 * @Author: LBH 1336709799@qq.com
 * @Date: 2025-02-07 07:57:22
 * @LastEditors: LBH 1336709799@qq.com
 * @LastEditTime: 2025-02-12 11:56:20
 * @FilePath: \jike\src\apis\article.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// 封装和文章相关的接口函数

import { request } from "@/utils";

// 获取频道列表
export function getChannelAPI(){
    return request({
        url:'/channels',
        method:'GET'
    })
}

// 提交文章表单
export function createArticleAPI(data){
    return request({
        url:'/mp/articles?draft=false',
        method:'POST',
        data
    })
}

// 获取文章列表
export function getArticleListAPI(params){
    return request({
        url:'/mp/articles',
        method:'GET',
        params
    })
}

// 删除文章
export function delArticleAPI(id){
    return request({
        url:`/mp/articles/${id}`,
        method:'DELETE'
    })
}

// 获取文章详情
export function getArticleById(id){
    return request({
        url:`/mp/articles/${id}`,
    })
}

//更新文章表单
export function updateArticleAPI(data){
    return request({
        url:`/mp/articles/${data.id}?draft=false`,
        method:'PUT',
        data
    })
}